//logs.js
// const util = require('../../utils/util.js')
const app=getApp()

Page({
  data:{
    navbarData: {
      title: '科室宣教',
      showCapsule: true
    },
    knowledgeContents: null,
    navHeight: app.globalData.statusBarHeight * 2 + 86,
    showNothing:false,

  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function () {
    var that = this;
    wx.showLoading({
      title: '加载中',
      mask:true
    })
    wx.request({
      url: app.getUrl('/xcx/education/queryDeptEducation'),
      method: 'GET',
      header: wx.getStorageSync('cookie'),
      success(res) {
        console.log(res)
        if(res.data.code==0){
          
          if(res.data.data.length!=0){
            that.setData({
              knowledgeContents: res.data.data
            })
          }else{
            that.setData({
              showNothing: true
            })
          }
        }
        wx.hideLoading();
      }
    })
  },
  toKnowledgeDetail: function (e) {
    // wx.removeStorageSync('education_data');
    // let html = {}
    // this.data.knowledgeContents.forEach(item => {
    //   if (item.id == e.currentTarget.dataset.id) {
    //     const { title, content } = item;
    //     html = { title, content };
    //   }
    // })
    // wx.setStorageSync('education_data', html);
    wx.navigateTo({
      url: "propagandaDetail/propagandaDetail?id=" + e.currentTarget.dataset.id + '&deptId=' + app.globalData.deptId
    })
  }
})
